<template>
  <el-dialog title="评测结果"
             :close-on-click-modal="false" append-to-body
             :visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
             width="1200px">
    <el-row :gutter="15" class="">
      <el-form ref="formRef" :model="dataForm" size="small" label-width="100px" label-position="left">
        <template v-if="!loading">
          <el-col :span="24">
            <jnpf-form-tip-item label="测试时间"
                                prop="creatortime">
              <p>{{ dataForm.creatortime }}</p>
            </jnpf-form-tip-item>
          </el-col>
          <el-col :span="24">
            <jnpf-form-tip-item label="企业名称"
                                prop="companyName">
              <p>{{ dataForm.companyName }}</p>
            </jnpf-form-tip-item>
          </el-col>
          <el-col :span="24">
            <jnpf-form-tip-item label="企业信用代码"
                                prop="creeditCode">
              <p>{{ dataForm.creeditCode }}</p>
            </jnpf-form-tip-item>
          </el-col>
          <el-col :span="24">
            <jnpf-form-tip-item label="分数"
                                prop="score">
              <p>{{ dataForm.score }}</p>
            </jnpf-form-tip-item>
          </el-col>
          <el-col :span="24">
            <jnpf-form-tip-item label="级别"
                                prop="levelname">
              <p>{{ dataForm.levelname }}</p>
            </jnpf-form-tip-item>
          </el-col>
          <el-col :span="24">
            <jnpf-form-tip-item label="描述"
                                prop="description">
              <p>{{ dataForm.description }}</p>
            </jnpf-form-tip-item>
          </el-col>
        </template>
      </el-form>
    </el-row>
    <span slot="footer" class="dialog-footer">
        <el-button @click="visible = false" type="primary"> 取 消</el-button>
    </span>
    <Detail v-if="detailVisible" ref="Detail" @close="detailVisible = false"/>
  </el-dialog>
</template>
<script>
import request from '@/utils/request'

import {getConfigData} from '@/api/onlineDev/visualDev'
import jnpf from '@/utils/jnpf'
import Detail from '@/views/basic/dynamicModel/list/detail'
import {thousandsFormat} from "@/components/Generator/utils/index"

export default {
  components: {Detail},
  props: [],
  data() {
    return {
      visible: false,
      detailVisible: false,
      loading: false,

      dataForm: {
        id: '',
        creatortime: '',
        companyName: '',
        creeditCode: '',
        score: '',
        levelname: '',
        description: '',
      },

    }
  },
  computed: {},
  watch: {},
  created() {

  },
  mounted() {
  },
  methods: {
    toDetail(defaultValue, modelId) {
      if (!defaultValue) return
      getConfigData(modelId).then(res => {
        if (!res.data || !res.data.formData) return
        let formData = JSON.parse(res.data.formData)
        formData.popupType = 'general'
        this.detailVisible = true
        this.$nextTick(() => {
          this.$refs.Detail.init(formData, modelId, defaultValue)
        })
      })
    },
    dataInfo(dataAll) {
      let _dataAll = dataAll
      this.dataForm = _dataAll
    },

    init(id) {
      this.dataForm.id = id || 0;
      this.visible = true;
      this.$nextTick(() => {
        if (this.dataForm.id) {
          this.loading = true
          request({
            url: '/api/example/Fz_enterprise_evaluation_score_record/detail/' + this.dataForm.id,
            method: 'get'
          }).then(res => {
            this.dataInfo(res.data)
            this.loading = false
          })
        }

      })
    },
  },
}

</script>
<style lang="scss" scoped>
::v-deep .el-dialog{
  background: url('../../../assets/images/review.png') no-repeat center;
  height: 644px;

  .el-dialog__body{
    height: 520px;
  }
}
</style>
